<template>
	<view>
		<view class="head">
			<view :class="['headItem',{'active':currentIndex==index}]" v-for="(item,index) in tabList" :key="index" @click="handleCheck(index)">
				{{item}}
			</view>
		</view>
		<view class="main">
			<slot name="left" v-if="currentIndex==0"></slot>
			<slot name="right" v-else></slot>
		</view>
	</view>
	
</template>

<script>
	export default {
		name:"uni-detail-tab",
		props:{
			tabList:Array
		},
		data() {
			return {
				currentIndex:0
			};
		},
		methods:{
			handleCheck(index){
				this.currentIndex = index
			}
		}
	}
</script>

<style lang="less">
	.head{
		display: flex;
		.headItem{
			flex: 1;
			height: 80rpx;
			display: flex;
			justify-content: center;
			align-items: center;
		}
		.active{
			color: orange;
		}
	}
</style>
